package com.wangwei.spring.rabbit;

import com.rabbitmq.client.Channel;
import com.wangwei.spring.rabbit.pojo.Order;
import com.wangwei.spring.rabbit.pojo.Person;
import com.wangwei.spring.rabbit.pojo.User;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * 自定义消息监听处理类
 * Created by wangwei on 2019/10/12 0012.
 */
public class MessageHandler {
    public void handleMessage(byte[] body){
        System.out.println("-----handleMessage------");
        System.out.println(new String(body));
    }

    public void ReceiveMsg(byte[] body){
        System.out.println("-----ReceiveMsg(byte)------");
        System.out.println(new String(body));
    }

    public void ReceiveMsg(String body){
        System.out.println("-----ReceiveMsg(String)------");
        System.out.println(new String(body));
    }

    public void ReceiveMsg(Body body){
        System.out.println("-----ReceiveMsg(Body)------");
        System.out.println(body.toString());
    }
    //LinkedHashMap
    public void ReceiveMsg(Map body){
        System.out.println("-----ReceiveMsg(Map)------");
        System.out.println(body.toString());
    }
    public void ReceiveMsg(List body){
        System.out.println("-----ReceiveMsg(List)------");
        System.out.println(body.get(0).getClass());
        System.out.println(body.toString());
    }

    public void ReceiveMsg(File body){
        System.out.println("-----ReceiveMsg(File)------");
        System.out.println(body);
    }

    public void ReceiveMsg(Order body){
        System.out.println("-----ReceiveMsg(Order)------");
        System.out.println(body);
    }

    public void ReceiveMsg(User body){
        System.out.println("-----ReceiveMsg(User)------");
        System.out.println(body);
    }

    public void ReceiveMsg(Person body){
        System.out.println("-----ReceiveMsg(Person)------");
        System.out.println(body);
    }

    public void ReceiveSms(byte[] body){
        System.out.println("-----处理sms消息------");
        System.out.println(new String(body));
    }
    public void ReceiveMail(byte[] body){
        System.out.println("-----处理mail消息------");
        System.out.println(new String(body));
    }
    public void ReceiveWeixin(byte[] body){
        System.out.println("-----处理weixin消息------");
        System.out.println(new String(body));
    }
}
